<script setup>
import { useRouter } from 'vue-router'
import { goRouter } from "@/utils"
import { ref, reactive, getCurrentInstance, onMounted, watch } from "vue"

import { globalStore } from "@/store/global"
const globalVue = globalStore();

const instance = getCurrentInstance()
const _this = instance.appContext.config.globalProperties; //vue3获取当前this
const storage = _this.$utils.storage;
let userInfo = JSON.parse(storage.getLocal('userinfo'));

onMounted(() => {
  init()
})

function init(){
  instance.proxy.$http.get('user.getUserById',{params: {id: userInfo.id}}).then(res => {
    globalVue.setUserInfo(res.data);
  });
}

</script>

<template>
  <router-view></router-view>
</template>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #ABAEB1;
}
</style>
